/*
 This file 'wxhxp_1' is part of Firebird Integrated Solution 1.0

 Copyright (c) 2020 Lincong

 Contact:  
        Email: lincong1987@gmail.com

        QQ: 159257119
 
 See Usage at http://www.jplatformx.com/firebird

 Create date: 2020-06-14 20:49
 */

define(function (require, exports, module) {

	require("../model/Chart");

	var ArrayUtils = require("../assets/ArrayUtils");

	var id = "wxhxp_2";

	Firebird.define(id, {
		extend: "Chart",
		setValue: function (data) {

			this.data = data = [
				{
					value: 10,
					name: "氯",
				}, {
					value: 20,
					name: "汽油"
				}, {
					value: 30,
					name: "柴油"
				}, {
					value: 40,
					name: "氢氧化钠"
				}, {
					value: 50,
					name: "丙酮"
				}, {
					value: 50,
					name: "盐酸"
				}, {
					value: 50,
					name: "石油醚"
				}, {
					value: 50,
					name: "甲醇"
				}, {
					value: 50,
					name: "正庚烷"
				}, {
					value: 50,
					name: "2-丙醇"
				}
			];

			var option = {

				color1: [
					Chart.linearGradient('rgba(201, 144, 74, 1)', 'rgba(226, 195, 146, 1)'),
					Chart.linearGradient("rgba(108, 42, 208, 1)", "rgba(128, 68, 229, 1)"),
					Chart.linearGradient("rgba(207, 122, 18, 1)", "rgba(229, 167, 71, 1)"),
					Chart.linearGradient("rgba(59, 81, 255, 1)", "rgba(88, 138, 255, 1)"),
					Chart.linearGradient("rgba(135, 53, 59, 1)", "rgba(191, 127, 134, 1)")
				],

				grid: {
					top: 30,
					bottom: 28,
					left: 120,
					right: 80
				},

				xAxis: {
					type: 'value',
					axisLine: {
						show: true,
						lineStyle: {
							color: "rgba(2, 234, 252, 0.3)"
						}
					},
					splitLine: {
						show: true,
						lineStyle: {
							color: "rgba(2, 234, 252, 0.3)"
						}
					},
					axisTick: {
						show: false
					},
					axisLabel: {
						show: false,
					}
				},
				yAxis: {
					type: 'category',
					axisLine: {
						lineStyle: {
							color: "rgba(2, 234, 252, 0.3)"
						}
					},
					splitLine: {
						lineStyle: {
							color: "rgba(2, 234, 252, 0.3)"
						}
					},
					axisTick: {},
					axisLabel: {
						margin: 20,
						fontSize: 16,
						color: "rgba(255, 255, 255, 1)"
					},
					data: data.map(function (node) {
						return node.name;
					})
				},

				series: [
					{
						type: 'bar',
						barWidth: 24,
						itemStyle: {
							color: Chart.linearGradient("rgba(97, 81, 240, 1)", "rgba(0, 32, 107, 1)", [1, 1, 0, 0])
						},
						label: {
							normal: {
								show: true,
								position: "right",
								fontSize: 16,
								color: '#fff'
							}
						},
						data: data.map(function (node) {
							return node.value;
						})
					},


				]

			};


			this.clear();
			this.setOption(option, !0);
		},
	});

	module.exports = Firebird.create(id, {id: id});
});